/***************************************************************************
 *   Copyright (C) 2010 by programmeboy                                    *
 *   programmeboy@gmail.com                                                *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.                                        *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             * 
 ***************************************************************************/

#include "disk.h"


/** \fn	int is_lba_support( char drive )
 *  \brief check the drive is support lba mode
 *  \param drive the disk
 *  \return 0 unsupport 1 support
 */

int is_lba_support( char drive )
{
	static char cached_drive = -1;
	static int cached_status;
	int ret_int = 0;

	if ( cached_drive == drive )
		goto end_ret;

	__asm{
		
		mov bx, 0x55aa
		mov dl, drive
		mov ah, 0x41
		int 0x13
		
		jc lab_un
		
		mov ret_int, bx

lab_un:
	}
	
	cached_status = (ret_int == 0xaa55);
end_ret:
	return cached_status;
}